Skip to content

scient: load installed Codex plugins' skills and MCP servers - #79

Open
yaacovcorcos wants to merge 8 commits into
mainfrom
claude/codex-plugins-20261121
Open

yaacovcorcos wants to merge 8 commits into
mainfrom
claude/codex-plugins-20261121

Conversation

@yaacovcorcos

Copy link
Copy Markdown
Contributor

Scient Agent now loads the skills and MCP servers of plugins installed and enabled in Codex, so a plugin added to Codex also works in Scient Agent.

  • New discovery source codex-plugins. It reads $CODEX_HOME/config.toml [plugins."<name>@<marketplace>"] and uses the same package version Codex runs from plugins/cache. Skills go through the existing skill reader and MCP servers through the existing Codex MCP mapping (env_vars, bearer_token_env_var, timeouts, package-relative command/cwd). Servers are named <plugin>:<server>.
  • It is opt-in through SCIENT_AGENT_ENABLE_SOURCES=codex-plugins or enabledProviders. --runtime-info lists it under enableSources so a host can check for it.
  • Left out: plugins that need OpenAI's host (browser, chrome, computer-use, unified-computer-use, codex-app-tools), servers launched by computer-use-client-launcher (Messages) or with auth: "chatgpt", .app.json app references (the ChatGPT-apps route already covers them), and hooks.
  • Ledger entry: SA-CODEX-PLUGINS.

Tests: the new codex-plugins tests plus the affected discovery, runtime-info and claude-plugins tests (52) pass. Typecheck, oxlint, oxfmt and the divergence check are clean. No plugin MCP server was started in testing.

Desktop side: ScientFactory/scient-desktop#1061 sets the source and shows Codex plugins as working with Scient Agent when the agent supports it.

Scient Agent reads the plugins Codex has installed and enabled ($CODEX_HOME/config.toml,
the version Codex runs from plugins/cache) and loads their skills and MCP servers through
the existing skill reader and Codex MCP mapping. The source is `codex-plugins`, opt-in through
SCIENT_AGENT_ENABLE_SOURCES or enabledProviders, and --runtime-info lists it under
enableSources so a host can check before enabling it. Plugins that need OpenAI's host
(browser, chrome, computer-use, unified-computer-use, codex-app-tools), servers launched by
computer-use-client-launcher or with auth "chatgpt", app references and hooks are left out.

Scient-Divergence: SA-CODEX-PLUGINS
…er skips alone

- A server whose plugin entry or config.toml policy sets enabled_tools (or a non-empty
  disabled_tools) is skipped with a warning: Scient Agent cannot enforce Codex's tool filters.
- Fields the mapper iterates are validated per server; a malformed server is skipped with a
  warning and its siblings still load.
@yaacovcorcos

Copy link
Copy Markdown
Contributor Author

0af9eab fixes two findings from a holistic Codex review:

  • A Codex plugin MCP server is no longer imported with more tools than Codex allows. A server whose .mcp.json entry or [plugins."<id>".mcp_servers.<name>] policy sets enabled_tools (or a non-empty disabled_tools) is skipped with a warning, because Scient Agent's MCP servers have no tool filter.
  • A malformed server is skipped with a warning, and its siblings still load. Before, it rejected the whole source.

New tests cover both. Desktop (ScientFactory/scient-desktop#1061) also now honors disabledProviders containing codex-plugins.

Codex review of 0af9eab:
- CODEX_HOME and header credentials come from the launch environment, never a project's .env.
- Stdio servers inherit only Codex's variable list plus their env_vars (MCPServer.envInherit),
  not the agent's whole environment; env values are literal, headers literal and origin-locked.
- [plugins._default] and /etc/codex/config.toml apply; nothing loads under an organization policy.
- Package files, cwd and relative commands must stay inside the symlink-resolved package.
- One transport per server with only its Codex fields; OAuth client settings, scopes and
  oauth_resource map; http_headers_helper and auth other than oauth are skipped.
- Same-named plugins from two marketplaces are named <plugin>.<marketplace>.
- Codex's manifest precedence: root Agent Plugins plugin.json, then .codex-, .claude-, .cursor-plugin.
- The plugin mapper no longer borrows the codex provider's config.toml mapper.
…ment and server rules

Second Codex review of 4d90a48:
- getLaunchEnv() (utils env.ts) is the exec environment when known (procfs, --no-env-file), else the
  environment without the values of the launch folder's Bun-autoloaded dotenv files and the agent's
  own .env files, whichever folder the agent works in now. CODEX_HOME, header credentials and
  servers' variables come from it.
- A stdio server's env is built as Codex builds it (variable list, absolute CA bundles, env_vars,
  literal env, minus Codex's non-inheritable names) and it inherits nothing else.
- System config merges at every depth; Windows system config and Group Policy RequirementsPath.
- Each skill and each legacy manifest's folder must stay in the package; a linked folder rejects.
- A declaration's enabled = false and a policy's auth = "ema_auth" disable a server.
- Mistyped command/url rejected; Agent Plugins mcp.json must be a regular file, sse is left out,
  and the legacy declaration's env_vars overlay applies.
- Same-named plugins are qualified <plugin>:<marketplace>, which no plugin name can collide with.
@yaacovcorcos
yaacovcorcos force-pushed the claude/codex-plugins-20261121 branch from ce4418f to e53bde7 Compare November 22, 2026 08:38
…, overlay, skill containment, fail-closed policy

Third Codex review of e53bde7:
- getLaunchEnv() returns only an authoritative snapshot (procfs, --no-env-file, or the compiled
  binary's environment before the agent's .env files, told by its bundled module URL); otherwise
  nothing loads, with a warning. The loader takes it through filterProcessEnv.
- An ema_auth key in a plugin's mcp_servers.<name> table disables the server; a server whose
  tools Codex asks about (prompt, writes or an unknown approval mode) is skipped.
- Agent Plugins stdio servers take env_vars only from a valid .codex-plugin declaration of the
  same server as a valid stdio server; Codex's non-inheritable names match in any case.
- Skills are scanned as Codex scans them (recursive for legacy plugins), each folder and SKILL.md
  contained before it is read, and carry containRoot for skill://.
- A policy location that cannot be checked counts as managed; Windows uses the ProgramData known
  folder and managed_config.toml in CODEX_HOME.
- Tests stand in for the launch environment instead of relying on mutations after Bun starts.
… field types and paths, fail-closed Windows probe

Fourth Codex review of 65ffa2e:
- getLaunchEnv() trusts the compiled binary only through __SCIENT_AGENT_NO_DOTENV__, which only
  compile-binary.ts defines (beside autoloadDotenv false), and no run given an explicit --env-file.
- A server with an ema_auth policy entry is left out with a warning, so enabledServers cannot start it.
- Legacy manifests and servers must have the field types Codex accepts (a .codex-plugin overlay too),
  manifest paths must be ./-relative without .., and a server bound to another Codex environment is
  skipped.
- Windows reads the ProgramData known folder and the 64-bit RequirementsPath in one PowerShell query;
  a failed query counts as managed. A leftover CODEX_HOME/managed_config.toml no longer does, as in Codex.
- Not changed: auto approval defers to the session's approval policy in Codex
  (mcp_permission_prompt_is_auto_approved), as it does to Scient Agent's approval mode here.
…lbacks, tool-name suffixes, strict Windows probe

Fifth Codex review of a507587:
- The Windows probe stops on any error and counts only an explicit success as no policy; a spawn
  failure counts as managed.
- A server whose tools Codex hides (non-empty omit_tools_from, values checked) is skipped.
- The user's [[skills.config]] rules apply to plugin skills in Codex's order (canonical path or name).
- Durations must be ones Rust's Duration::try_from_secs_f64 takes, so a negative startup_timeout_sec
  rejects the declaration and its env_vars.
- Manifest paths Codex drops fall back to skills/ and .mcp.json, as in Codex.
- Servers whose names would give their tools the same names take a stable -<6 hex> suffix.
…strict [plugins], u64 timeouts, POSIX paths

Sixth Codex review of 24ee20a:
- Server names no longer take a suffix that depends on other plugins, so disabledServers and
  enabledServers keep matching; the normalized tool-name collision stays a documented gap.
- [[skills.config]] names match <manifest name>:<skill>, as Codex namespaces plugin skills.
- A merged [plugins] table with a field of a type Codex rejects loads nothing, as in Codex.
- startup_timeout_ms must fit a u64.
- A backslash separates manifest path parts only on Windows, and rooted paths are dropped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant